<%@ page import="com.goal98.team.Constants" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title><g:message code="venue.list" default="Venue List"/></title>
  </head>
  <body>
    <div class="nav">
    %{--<span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>--}%
      <g:ifAnyGranted role="${Constants.ROLE_ADMIN}">
        <span class="menuButton"><g:link class="create" action="create"><g:message code="venue.new" default="New Venue"/></g:link></span>
      </g:ifAnyGranted>
    </div>
    <div class="body">
      <h1><g:message code="venue.list" default="Venue List"/></h1>
      <g:if test="${flash.message}">
        <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}"/></div>
      </g:if>
      <div class="list">
        <table>
          <thead>
            <tr>

              <g:sortableColumn property="id" title="Id" titleKey="venue.id"/>

              <g:sortableColumn property="costAmount" title="Cost Amount" titleKey="venue.costAmount"/>

              <g:ifAnyGranted role="${Constants.ROLE_ADMIN}">

                <g:sortableColumn property="lat" title="Lat" titleKey="venue.lat"/>

                <g:sortableColumn property="lng" title="Lng" titleKey="venue.lng"/>

              </g:ifAnyGranted>

              <g:sortableColumn property="name" title="Name" titleKey="venue.name"/>

              <g:sortableColumn property="timeCanPlay" title="Time Can Play" titleKey="venue.timeCanPlay"/>

            </tr>
          </thead>
          <tbody>
            <g:each in="${venueInstanceList}" status="i" var="venueInstance">
              <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

                <td><g:link action="show" id="${venueInstance.id}">${fieldValue(bean: venueInstance, field: "id")}</g:link></td>

                <td><g:formatNumber number="${venueInstance.costAmount}"/></td>

                <g:ifAnyGranted role="${Constants.ROLE_ADMIN}">

                  <td>${fieldValue(bean: venueInstance, field: "lat")}</td>

                  <td>${fieldValue(bean: venueInstance, field: "lng")}</td>

                </g:ifAnyGranted>

                <td><g:link action="show" id="${venueInstance.id}">${fieldValue(bean: venueInstance, field: "name")}</g:link></td>

                <td><g:formatNumber number="${venueInstance.timeCanPlay}"/></td>

              </tr>
            </g:each>
          </tbody>
        </table>
      </div>
      <div class="paginateButtons">
        <g:paginate total="${venueInstanceTotal}"/>
      </div>
    </div>
  </body>
</html>
